package com.haiheng.module_main.mode

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.haiheng.common.api.API
import com.haiheng.common.bean.AccessTokenBean
import com.haiheng.common.constant.AppConstant
import com.haiheng.library.log.LogUtils
import com.haiheng.library.log.LogWriter
import com.haiheng.library_base.http.*
import com.haiheng.library_base.model.BaseViewModel
import com.haiheng.library_base.utils.SPUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

/**
 *
 * @Des:
 * @Author: hwz
 * @Date:2023/4/14 0014
 * @Version: 1.0
 */
class MainViewModel : BaseViewModel() {


    var showMsg = MutableLiveData<String>()



    fun reportStatus(){
        LogUtils.d("ReportService reportStatus  ${this.hashCode()}")
       /* viewModelScope.launch(Dispatchers.IO) {
            val request = HttpRequest(API.PATH.EDC_MACH_STATUS)
                .putHeader(API.PARAM.PARAM_HEADER_TOKEN,AppConstant.getToken())
                .setJsonObjec(RequestDataHelper.getAddStatusData())
            var response = postJson<HttpResponse>(request)
            showMsg.postValue("${response.toJson()}")
            if (response != null){
                if (response.errorCode.equals("0")){
                    LogUtils.d("上报状态成功 :"+response.toJson())
                }else{
                    LogWriter.e("上报状态失败 :"+response.toJson())
                }
            }else{
                if (response != null
                    && response.errorMsg != null
                    && response.errorMsg.contains("Unauthorized")){
                    getToken()
                }
                LogWriter.e("上报状态失败 ${response.toJson()}")
            }
        }*/
    }
}